<?php

namespace app\index\controller;

use app\api\model\Member;
use think\facade\View;

class Index
{



    public function index()
    {
        View::assign('url', 'https://www.baidu.com/');
        return View::fetch();
    }
    public function login()
    {
       $mobile = input('');
       $password = input('');
       $captcha = input('');
       if (empty($mobile)) output_error('');
       if (empty($password)) output_error('');
       if (empty($captcha)) output_error('');
       if (!captcha_check($captcha)) output_error('');
       $condition = array();
       $condition[] = ['member_mobile', '=', $mobile];
       $condition[] = ['member_password', '=', md5($password)];
       $member = Member::where($condition)->field();
       if (empty($member)) output_error('');
       session('member_id',$member['member_id']);
       header("Content-Type: aoolication/json; charset=UTF-8");
       $array = array();
       $array['code'] = 1;
       $array['msg'] = 'success';
       $array['data'] = '1';
       echo json_encode($array);
     }

}
